/*
 Navicat Premium Data Transfer

 Source Server         : localhost
 Source Server Type    : SQL Server
 Source Server Version : 11002100
 Source Host           : localhost:1433
 Source Catalog        : shiro
 Source Schema         : dbo

 Target Server Type    : SQL Server
 Target Server Version : 11002100
 File Encoding         : 65001

 Date: 21/08/2021 16:19:19
*/


-- ----------------------------
-- Table structure for sys_permission
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_permission]') AND type IN ('U'))
	DROP TABLE [dbo].[sys_permission]
GO

CREATE TABLE [dbo].[sys_permission] (
  [permission_id] int  NOT NULL,
  [permission_name] varchar(32) COLLATE Chinese_PRC_CI_AS  NULL,
  [pid] int  NULL,
  [url] varchar(32) COLLATE Chinese_PRC_CI_AS  NULL,
  [permissions] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[sys_permission] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'权限id',
'SCHEMA', N'dbo',
'TABLE', N'sys_permission',
'COLUMN', N'permission_id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'权限名称',
'SCHEMA', N'dbo',
'TABLE', N'sys_permission',
'COLUMN', N'permission_name'
GO

EXEC sp_addextendedproperty
'MS_Description', N'上级id',
'SCHEMA', N'dbo',
'TABLE', N'sys_permission',
'COLUMN', N'pid'
GO

EXEC sp_addextendedproperty
'MS_Description', N'url',
'SCHEMA', N'dbo',
'TABLE', N'sys_permission',
'COLUMN', N'url'
GO

EXEC sp_addextendedproperty
'MS_Description', N'权限字符串',
'SCHEMA', N'dbo',
'TABLE', N'sys_permission',
'COLUMN', N'permissions'
GO


-- ----------------------------
-- Records of sys_permission
-- ----------------------------
INSERT INTO [dbo].[sys_permission] ([permission_id], [permission_name], [pid], [url], [permissions]) VALUES (N'1', N'add', NULL, N'/user/add', N'sys:user:add')
GO

INSERT INTO [dbo].[sys_permission] ([permission_id], [permission_name], [pid], [url], [permissions]) VALUES (N'2', N'update', NULL, N'/user/update', N'sys:user:update')
GO

INSERT INTO [dbo].[sys_permission] ([permission_id], [permission_name], [pid], [url], [permissions]) VALUES (N'3', N'del', NULL, N'/user/del', N'sys:user:del')
GO

INSERT INTO [dbo].[sys_permission] ([permission_id], [permission_name], [pid], [url], [permissions]) VALUES (N'4', N'list', NULL, N'/user/list', N'sys:user:list')
GO


-- ----------------------------
-- Table structure for sys_role
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_role]') AND type IN ('U'))
	DROP TABLE [dbo].[sys_role]
GO

CREATE TABLE [dbo].[sys_role] (
  [role_id] int  NOT NULL,
  [role_name] varchar(32) COLLATE Chinese_PRC_CI_AS  NULL,
  [status] int  NULL
)
GO

ALTER TABLE [dbo].[sys_role] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'角色名称',
'SCHEMA', N'dbo',
'TABLE', N'sys_role',
'COLUMN', N'role_name'
GO

EXEC sp_addextendedproperty
'MS_Description', N'状态',
'SCHEMA', N'dbo',
'TABLE', N'sys_role',
'COLUMN', N'status'
GO


-- ----------------------------
-- Records of sys_role
-- ----------------------------
INSERT INTO [dbo].[sys_role] ([role_id], [role_name], [status]) VALUES (N'1', N'超管角色', N'1')
GO

INSERT INTO [dbo].[sys_role] ([role_id], [role_name], [status]) VALUES (N'2', N'教师', N'1')
GO

INSERT INTO [dbo].[sys_role] ([role_id], [role_name], [status]) VALUES (N'3', N'学生', N'1')
GO

INSERT INTO [dbo].[sys_role] ([role_id], [role_name], [status]) VALUES (N'4', N'校长', N'1')
GO


-- ----------------------------
-- Table structure for sys_role_permission
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_role_permission]') AND type IN ('U'))
	DROP TABLE [dbo].[sys_role_permission]
GO

CREATE TABLE [dbo].[sys_role_permission] (
  [role_id] int  NOT NULL,
  [permission_id] int  NOT NULL
)
GO

ALTER TABLE [dbo].[sys_role_permission] SET (LOCK_ESCALATION = TABLE)
GO


-- ----------------------------
-- Records of sys_role_permission
-- ----------------------------
INSERT INTO [dbo].[sys_role_permission] ([role_id], [permission_id]) VALUES (N'1', N'1')
GO

INSERT INTO [dbo].[sys_role_permission] ([role_id], [permission_id]) VALUES (N'1', N'2')
GO

INSERT INTO [dbo].[sys_role_permission] ([role_id], [permission_id]) VALUES (N'1', N'3')
GO

INSERT INTO [dbo].[sys_role_permission] ([role_id], [permission_id]) VALUES (N'1', N'4')
GO

INSERT INTO [dbo].[sys_role_permission] ([role_id], [permission_id]) VALUES (N'2', N'4')
GO

INSERT INTO [dbo].[sys_role_permission] ([role_id], [permission_id]) VALUES (N'4', N'1')
GO

INSERT INTO [dbo].[sys_role_permission] ([role_id], [permission_id]) VALUES (N'4', N'2')
GO

INSERT INTO [dbo].[sys_role_permission] ([role_id], [permission_id]) VALUES (N'4', N'4')
GO


-- ----------------------------
-- Table structure for sys_user
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_user]') AND type IN ('U'))
	DROP TABLE [dbo].[sys_user]
GO

CREATE TABLE [dbo].[sys_user] (
  [user_id] int  IDENTITY(1,3) NOT NULL,
  [user_name] varchar(32) COLLATE Chinese_PRC_CI_AS  NULL,
  [sex] int  NULL,
  [password] varchar(32) COLLATE Chinese_PRC_CI_AS  NULL,
  [status] int  NULL,
  [salt] varchar(32) COLLATE Chinese_PRC_CI_AS  NULL,
  [remark] varchar(64) COLLATE Chinese_PRC_CI_AS  NULL
)
GO

ALTER TABLE [dbo].[sys_user] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'id',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'user_id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'用户名',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'user_name'
GO

EXEC sp_addextendedproperty
'MS_Description', N'性别',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'sex'
GO

EXEC sp_addextendedproperty
'MS_Description', N'密码',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'password'
GO

EXEC sp_addextendedproperty
'MS_Description', N'状态 0 是  1否',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'status'
GO

EXEC sp_addextendedproperty
'MS_Description', N'盐',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'salt'
GO

EXEC sp_addextendedproperty
'MS_Description', N'备注',
'SCHEMA', N'dbo',
'TABLE', N'sys_user',
'COLUMN', N'remark'
GO


-- ----------------------------
-- Records of sys_user
-- ----------------------------
SET IDENTITY_INSERT [dbo].[sys_user] ON
GO

INSERT INTO [dbo].[sys_user] ([user_id], [user_name], [sex], [password], [status], [salt], [remark]) VALUES (N'1', N'admin', N'1', N'95a7f3d9ca72db81d0bdf6cce3e1f086', N'1', N'kAFNzCvhrvGSu9o/KvdWBQ==', N'超管[123]')
GO

INSERT INTO [dbo].[sys_user] ([user_id], [user_name], [sex], [password], [status], [salt], [remark]) VALUES (N'5', N'zs', N'1', N'95a7f3d9ca72db81d0bdf6cce3e1f086', N'1', N'kAFNzCvhrvGSu9o/KvdWBQ==', N'教师[123]')
GO

INSERT INTO [dbo].[sys_user] ([user_id], [user_name], [sex], [password], [status], [salt], [remark]) VALUES (N'8', N'ww', N'1', N'4ee36853b4622c0e9e91164b6b51205a', N'1', N'o9VY/2TNzXK3gMwlekJMIg==', N'学生[123]')
GO

INSERT INTO [dbo].[sys_user] ([user_id], [user_name], [sex], [password], [status], [salt], [remark]) VALUES (N'3005', N'xz', N'1', N'53184e8e968e32c5b276093466bccdf0', NULL, N'S+4a5VK/g26WdMx471lLbg==', N'校长[123]')
GO

SET IDENTITY_INSERT [dbo].[sys_user] OFF
GO


-- ----------------------------
-- Table structure for sys_user_role
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[sys_user_role]') AND type IN ('U'))
	DROP TABLE [dbo].[sys_user_role]
GO

CREATE TABLE [dbo].[sys_user_role] (
  [user_id] int  NOT NULL,
  [role_id] int  NOT NULL
)
GO

ALTER TABLE [dbo].[sys_user_role] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'用户id',
'SCHEMA', N'dbo',
'TABLE', N'sys_user_role',
'COLUMN', N'user_id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'角色id',
'SCHEMA', N'dbo',
'TABLE', N'sys_user_role',
'COLUMN', N'role_id'
GO


-- ----------------------------
-- Records of sys_user_role
-- ----------------------------
INSERT INTO [dbo].[sys_user_role] ([user_id], [role_id]) VALUES (N'1', N'1')
GO

INSERT INTO [dbo].[sys_user_role] ([user_id], [role_id]) VALUES (N'5', N'2')
GO

INSERT INTO [dbo].[sys_user_role] ([user_id], [role_id]) VALUES (N'8', N'3')
GO

INSERT INTO [dbo].[sys_user_role] ([user_id], [role_id]) VALUES (N'3005', N'4')
GO


-- ----------------------------
-- Primary Key structure for table sys_permission
-- ----------------------------
ALTER TABLE [dbo].[sys_permission] ADD CONSTRAINT [PK__sys_perm__E5331AFA237D1109] PRIMARY KEY CLUSTERED ([permission_id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table sys_role
-- ----------------------------
ALTER TABLE [dbo].[sys_role] ADD CONSTRAINT [PK__sys_role__760965CC2470D2B1] PRIMARY KEY CLUSTERED ([role_id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table sys_role_permission
-- ----------------------------
ALTER TABLE [dbo].[sys_role_permission] ADD CONSTRAINT [PK__sys_role__C85A5463E51D4370] PRIMARY KEY CLUSTERED ([role_id], [permission_id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Auto increment value for sys_user
-- ----------------------------
DBCC CHECKIDENT ('[dbo].[sys_user]', RESEED, 6002)
GO


-- ----------------------------
-- Primary Key structure for table sys_user
-- ----------------------------
ALTER TABLE [dbo].[sys_user] ADD CONSTRAINT [PK__sys_user__B9BE370FBB632A1D] PRIMARY KEY CLUSTERED ([user_id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table sys_user_role
-- ----------------------------
ALTER TABLE [dbo].[sys_user_role] ADD CONSTRAINT [PK__sys_user__B9BE370F4630FBF4] PRIMARY KEY CLUSTERED ([user_id], [role_id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO

